package io.gitee.chearnee.community;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

@Slf4j
@SpringBootApplication
public class CommunityApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext run = SpringApplication.run(CommunityApplication.class, args);
		Environment env = run.getEnvironment();
		log.info(
				"""
						--------------------------------------------------------------------------------------------------------------------
						Application 【{}】 is running on 【{}】 environment!
						Api Local: \thttp://127.0.0.1:{}
						Mysql: \t{}\t username:{}
						Redis: \t{}:{}\t database:{}
						RabbitMQ: \t{}\t username:{}""",
				env.getProperty("spring.application.name"),
				env.getProperty("spring.profiles.active"),
				env.getProperty("server.port"),
				env.getProperty("spring.datasource.url"),
				env.getProperty("spring.datasource.username"),
				env.getProperty("spring.redis.host"),
				env.getProperty("spring.redis.port"),
				env.getProperty("spring.redis.database"),
				env.getProperty("spring.rabbitmq.addresses"),
				env.getProperty("spring.rabbitmq.username") +
				"\n----------------------------------------------------------");
	}

}
